From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 (+0000) Subject: Protect __release_resource against resources without parents X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~9^2~198 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=779942fb944cb07649891b6e6aeb2c3635cca859;p=linux-4.9.git Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. Signed-off-by: Phil Elwell --- diff --git a/kernel/resource.c b/kernel/resource.c index 9b5f04404152..f8a9af6e6b91 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -246,6 +246,12 @@ static int __release_resource(struct resource *old, bool release_child) { struct resource *tmp, **p, *chd; + if (!old->parent) { + WARN(old->sibling, "sibling but no parent"); + if (old->sibling) + return -EINVAL; + return 0; + } p = &old->parent->child; for (;;) { tmp = *p;